package com.archermind.style.controller;

import com.archermind.style.bean.OperationLog;
import com.archermind.style.interceptor.Auth;
import com.archermind.style.service.OperationService;
import com.archermind.style.util.Result;
import com.archermind.style.util.Search;
import com.feng.fengDUtil.Page;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


/**
 *@Author 丰建立
 *@Date 2019/1/25 16:43
 * ["查看日志","删除日志"]
 */
@Auth("查看日志")
@RestController
@RequestMapping(value = "/operation")
public class OperationAction {


    @Autowired
    private OperationService opService;

    @RequestMapping(value = "/list")
    public Result listRelease(Page page, Search search) {
        opService.query(page,search);
        return Result.success(page);
    }

    @Auth("删除日志")
    @RequestMapping(value="/del")
    public Result del(String ids){
        try {
            opService.deleteByIds(OperationLog.class,ids);
            return Result.success();
        } catch (Exception e) {
            return Result.error(e.getMessage());
        }
    }
}